package priv.pront.code.national.acwing.competition;

import java.util.Scanner;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-05-27 22:03
 */
public class Acwing5030_核心元素 {

    static int n, maxCount, maxNum;
    static int[] a;
    static int[] cnt, cnt2;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        cnt = new int[n + 2];
        a = new int[n + 2];
        for (int i = 1; i <= n; i++) {
            a[i] = scanner.nextInt();
        }

        for (int i = 1; i <= n; i++) {
            cnt2 = new int[n + 2];
            for (int j = i; j <= n; j++) {
                cnt2[a[j]]++;
                if (i == j) {
                    maxCount = 1;
                    maxNum = a[j];
                } else {
                    if (cnt2[a[j]] == maxCount && maxNum > a[j]) {
                        maxNum = a[j];
                    }
                    if (cnt2[a[j]] > maxCount) {
                        maxCount = cnt2[a[j]];
                        maxNum = a[j];
                    }
                }
                cnt[maxNum]++;
            }
        }
        for (int i = 1; i <= n; i++) {
            System.out.print(cnt[i] + " ");
        }
    }
}
